﻿<%@ Page Title="Manage Account" Language="C#" MasterPageFile="~/Web/Site.Master" AutoEventWireup="true" CodeBehind="MangeAccount.aspx.cs" Inherits="pwblog.Web.Management.MangeAccount" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1>Management Accounts</h1>
    <hr />
    <p>Show all Accounts</p>
    <asp:GridView ID="gvAccounts" runat="server"
        OnRowCommand="gvAccounts_RowCommand"
        OnRowEditing="gvAccounts_RowEditing"
        OnRowDeleting="gvAccounts_RowDeleting"
        OnRowUpdating="gvAccounts_RowUpdating"
        OnRowCancelingEdit="gvAccounts_RowCancelingEdit"
        OnRowDataBound="gvAccounts_RowDataBound"
        AutoGenerateColumns="False"
        Width="760px"
        DataKeyNames="UserName,Roles"
        ShowFooter="True" CellPadding="4" ForeColor="#333333" GridLines="None"
        PageSize="5"
        AllowPaging="true" onpageindexchanging="gvAccounts_PageIndexChanging"
        >
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    <Columns>
            
            <asp:TemplateField HeaderText="UserName" HeaderStyle-HorizontalAlign="Left" ControlStyle-Width="90px">
                <ItemTemplate>
                    <%# Eval("UserName") %>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="txtUserName" runat="server" Width="90px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvUserName" ValidationGroup="Insert" runat="server"
                        ControlToValidate="txtUserName" ErrorMessage="Please Enter UserName" 
                        ToolTip="Please Enter UserName"
                        SetFocusOnError="true" ForeColor="Red">*</asp:RequiredFieldValidator>
                </FooterTemplate>

<ControlStyle Width="90px"></ControlStyle>

<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
            </asp:TemplateField>
            
            <asp:TemplateField HeaderText="Password" HeaderStyle-HorizontalAlign="Left" ControlStyle-Width="90px">
                <ItemTemplate>
                    <%# Eval("Password") %>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="txtPassword" runat="server" Width="90px" TextMode="Password"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvPassword" ValidationGroup="Insert" runat="server"
                        ControlToValidate="txtPassword" ErrorMessage="Please Enter Password" 
                        ToolTip="Please Enter Password"
                        SetFocusOnError="true" ForeColor="Red">*</asp:RequiredFieldValidator>
                </FooterTemplate>

<ControlStyle Width="90px"></ControlStyle>

<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
            </asp:TemplateField>

            <asp:TemplateField HeaderText="Birthday" HeaderStyle-HorizontalAlign="Left" ControlStyle-Width="90px">
                <EditItemTemplate>
                    <asp:TextBox ID="txtBirthday" runat="server" Text='<%# Bind("Birthday") %>'
                        Width="90px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvBirthday" ValidationGroup="Update" runat="server"
                        ControlToValidate="txtBirthday" ErrorMessage="Please Enter Birthday" 
                        ToolTip="Please Enter Birthday"
                        SetFocusOnError="true" ForeColor="Red">*</asp:RequiredFieldValidator>
                </EditItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="txtBirthday" runat="server" Width="90px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvBirthday" ValidationGroup="Insert" runat="server"
                        ControlToValidate="txtBirthday" ErrorMessage="Please Enter Birthday" 
                        ToolTip="Please Enter Birthday"
                        SetFocusOnError="true" ForeColor="Red">*</asp:RequiredFieldValidator>
                </FooterTemplate>
                <ItemTemplate>
                    <%# Eval("Birthday")%>
                </ItemTemplate>

<ControlStyle Width="90px"></ControlStyle>

<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
            </asp:TemplateField>

            <asp:TemplateField HeaderText="Address" HeaderStyle-HorizontalAlign="Left" ControlStyle-Width="90px">
                <EditItemTemplate>
                    <asp:TextBox ID="txtAddress" runat="server" Text='<%# Bind("Address") %>'
                        Width="90px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvAddress" ValidationGroup="Update" runat="server"
                        ControlToValidate="txtAddress" ErrorMessage="Please Enter Address" 
                        ToolTip="Please Enter Address"
                        SetFocusOnError="true" ForeColor="Red">*</asp:RequiredFieldValidator>
                </EditItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="txtAddress" runat="server" Width="90px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvAddress" ValidationGroup="Insert" runat="server"
                        ControlToValidate="txtAddress" ErrorMessage="Please Enter Address" 
                        ToolTip="Please Enter Address"
                        SetFocusOnError="true" ForeColor="Red">*</asp:RequiredFieldValidator>
                </FooterTemplate>
                <ItemTemplate>
                    <%# Eval("Address")%>
                </ItemTemplate>

<ControlStyle Width="90px"></ControlStyle>

<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
            </asp:TemplateField>

            <asp:TemplateField HeaderText="Roles" HeaderStyle-HorizontalAlign="Left">
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlRoles" runat="server" DataValueField="Value">
                        <asp:ListItem Text="User" Value="user"></asp:ListItem>
                        <asp:ListItem Text="Creator" Value="creator"></asp:ListItem>
                        <asp:ListItem Text="Admin" Value="admin,creator"></asp:ListItem>
                    </asp:DropDownList>
                </EditItemTemplate>
                <ItemTemplate>
                    <%# Eval("Roles")%>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:DropDownList ID="ddlRoles" runat="server">
                        <asp:ListItem Text="User" Value="user"></asp:ListItem>
                        <asp:ListItem Text="Creator" Value="creator"></asp:ListItem>
                        <asp:ListItem Text="Admin" Value="admin,creator"></asp:ListItem>
                    </asp:DropDownList>
                </FooterTemplate>

<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
            </asp:TemplateField>

            <asp:TemplateField HeaderText="NumArticle" HeaderStyle-HorizontalAlign="Left" ControlStyle-Width="90px">
                <ItemTemplate>
                    <%# Eval("NumberOfArticle")%>
                </ItemTemplate>

<ControlStyle Width="90px"></ControlStyle>

<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
            </asp:TemplateField>

            <asp:TemplateField HeaderText="Edit" ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
                <EditItemTemplate>
                    <asp:LinkButton ID="lnkUpdate" runat="server" CausesValidation="True" CommandName="Update"
                        Text="Cập nhật" OnClientClick="return confirm('Update?')" CssClass="button"
                        ValidationGroup="Update"></asp:LinkButton>
                    <asp:ValidationSummary ID="vsUpdate" runat="server" ShowMessageBox="true" ShowSummary="false"
                        ValidationGroup="Update" Enabled="true" HeaderText="Validation Summary..." />
                    <asp:LinkButton ID="lnkCancel" runat="server" CausesValidation="False" CommandName="Cancel"
                        Text="Hủy" CssClass="button"></asp:LinkButton>
                </EditItemTemplate>
                <FooterTemplate>
                <asp:LinkButton ID="lnkAdd" runat="server" CausesValidation="True" CommandName="Insert"
                    ValidationGroup="Insert" Text="Thêm" CssClass="button"></asp:LinkButton>
                <asp:ValidationSummary ID="vsInsert" runat="server" ShowMessageBox="true" ShowSummary="false"
                    ValidationGroup="Insert" Enabled="true" HeaderText="Validation..." />
                </FooterTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="lnkEdit" runat="server" CausesValidation="False" CommandName="Edit"
                        Text="Sửa" CssClass="button"></asp:LinkButton>
                </ItemTemplate>
                <HeaderStyle HorizontalAlign="Left" />
                <ItemStyle Width="50px" />
            </asp:TemplateField>

            
            <asp:TemplateField HeaderText="Delete" ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
                <ItemTemplate>
                    <asp:LinkButton ID="lnkDelete" runat="server" CausesValidation="False" CommandName="Delete"
                        Text="Xóa" CssClass="button" OnClientClick="return confirm('Delete?')"></asp:LinkButton>
                </ItemTemplate>
                <HeaderStyle HorizontalAlign="Left" />
                <ItemStyle Width="50px" />
            </asp:TemplateField>
        </Columns>
         <PagerSettings FirstPageText="First" LastPageText="Last" NextPageText="Next" 
            PreviousPageText="Previous" />
        <EditRowStyle BackColor="#999999" />
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#E9E7E2" />
        <SortedAscendingHeaderStyle BackColor="#506C8C" />
        <SortedDescendingCellStyle BackColor="#FFFDF8" />
        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
    </asp:GridView>

    <br /><br /><br /><br /><br /><br />
</asp:Content>

